package com.appkubes.mall.restful.application.goods.associate.controller;

import com.appkubes.cloud.config.params.paramValid.ParamValid;
import com.appkubes.common.Response;
import com.appkubes.mall.core.entity.MallGoods;
import com.appkubes.mall.restful.application.goods.associate.dao.GoodsAssociateDao;
import com.appkubes.mall.restful.application.goods.associate.service.GoodsAssociateService;
import com.appkubes.mall.restful.application.goods.goods.entity.vo.MallGoodVo;
import com.appkubes.mall.restful.application.goods.goods.service.GoodsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Api("商品组合模块")
@RestController
@RequestMapping("/goods/associate")
public class GoodsAssociateController {

    @Autowired
    GoodsAssociateService goodsAssociateService;

    @Autowired
    GoodsService goodsService;
    @Resource
    GoodsAssociateDao goodsAssociateDao;

    @ApiOperation("获取组合商品")
    @GetMapping("/getList")
    public Response getList(@ParamValid MallGoodVo mallGoodVo) {
        List<MallGoods> goods = goodsAssociateDao.selectAssociateGoods(mallGoodVo.getGoodsKey());
        return Response.success(goods);
    }
}
